$(function() {

$("#username").blur(
		function() {
			$("#username_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#username").after("<span id='username_msg' style='color: red'>用户名不能为空</span>");
			}
	});

$("#password").blur(
		function() {
			$("#password_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#password").after("<span id='password_msg' style='color: red'>密码不能为空</span>");
			}
	});

$("#companyname").blur(
		function() {
			$("#companyname_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#companyname").after("<span id='companyname_msg' style='color: red'>企业名称不能为空</span>");
			}
	});

$("#workdate").blur(
		function() {
			$("#workdate_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#workdate").after("<span id='workdate_msg' style='color: red'>工商注册日期不能为空</span>");
			}
	});

$("#scale").blur(
		function() {
			$("#scale_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#scale").after("<span id='scale_msg' style='color: red'>企业规模不能为空</span>");
			}
	});

$("#address").blur(
		function() {
			$("#address_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#address").after("<span id='address_msg' style='color: red'>企业地址不能为空</span>");
			}
	});

$("#tel").blur(
		function() {
			$("#tel_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#tel").after("<span id='tel_msg' style='color: red'>联系电话不能为空</span>");
			}
	});

$("#qq").blur(
		function() {
			$("#qq_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#qq").after("<span id='qq_msg' style='color: red'>联系QQ不能为空</span>");
			}
	});

$("#memo").blur(
		function() {
			$("#memo_msg").empty();
			var name = $(this).val();
			if (name == "" || name == null) {
				$("#memo").after("<span id='memo_msg' style='color: red'>备注不能为空</span>");
			}
	});







$('#sub').click(function(){
var username = $("#username").val();
var password = $("#password").val();
var companyname = $("#companyname").val();
var workdate = $("#workdate").val();
var scale = $("#scale").val();
var address = $("#address").val();
var tel = $("#tel").val();
var qq = $("#qq").val();
var memo = $("#memo").val();
$("#username_msg").empty();
$("#password_msg").empty();
$("#companyname_msg").empty();
$("#workdate_msg").empty();
$("#scale_msg").empty();
$("#address_msg").empty();
$("#tel_msg").empty();
$("#qq_msg").empty();
$("#memo_msg").empty();
if (username == "" || username == null) {
	$("#username").after("<span id='username_msg' style='color: red'>用户名不能为空</span>");
	return false;
}
if (password == "" || password == null) {
	$("#password").after("<span id='password_msg' style='color: red'>密码不能为空</span>");
	return false;
}
if (companyname == "" || companyname == null) {
	$("#companyname").after("<span id='companyname_msg' style='color: red'>企业名称不能为空</span>");
	return false;
}
if (workdate == "" || workdate == null) {
	$("#workdate").after("<span id='workdate_msg' style='color: red'>工商注册日期不能为空</span>");
	return false;
}
if (scale == "" || scale == null) {
	$("#scale").after("<span id='scale_msg' style='color: red'>企业规模不能为空</span>");
	return false;
}
if (address == "" || address == null) {
	$("#address").after("<span id='address_msg' style='color: red'>企业地址不能为空</span>");
	return false;
}
if (tel == "" || tel == null) {
	$("#tel").after("<span id='tel_msg' style='color: red'>联系电话不能为空</span>");
	return false;
}
if (qq == "" || qq == null) {
	$("#qq").after("<span id='qq_msg' style='color: red'>联系QQ不能为空</span>");
	return false;
}
if (memo == "" || memo == null) {
	$("#memo").after("<span id='memo_msg' style='color: red'>备注不能为空</span>");
	return false;
}
});
$('#res').click(function() {
$("#username_msg").empty();
$("#password_msg").empty();
$("#companyname_msg").empty();
$("#workdate_msg").empty();
$("#scale_msg").empty();
$("#address_msg").empty();
$("#tel_msg").empty();
$("#qq_msg").empty();
$("#memo_msg").empty();
});

});
